<link rel="stylesheet" href="__PUBLIC__/admin/css/bootstrap.css">
<div class="content"> 
                <div class="operation">
                    <div class="pull-left">
                        
                            <button type="submit" class="add"><span class="glyphicon glyphicon-plus"></span>提交订单</button>
                        
                    </div>
                    <div class="right-box">
                        <input type="search" placeholder="搜索..." name="search" class="search" value="{$search}">
                        <span class="glyphicon glyphicon-search" id="sub"></span>
                    </div>
                </div>
                <table class="table">
                    <tbody>
                    <tr>
                        <volist name="header" id="vo">
                            <th>{$vo}
                                <span>
                                    <a class="glyphicon glyphicon-triangle-top"></a>
                                    <a class="glyphicon glyphicon-triangle-bottom"></a>
                                </span>
                            </th>
                        </volist>
                        <th>操作
                            <span>
                                <a class="glyphicon glyphicon-triangle-top"></a>
                                <a class="glyphicon glyphicon-triangle-bottom"></a>
                            </span>
                        </th>
                    </tr>
                        <volist name="list" id="vo">
                        <tr>
                            <volist name="vo" id="v">
                                <td>{$v}</td>
                            </volist>
                            <td>
                                <a class="glyphicon glyphicon-trash"  href="{:U('Admin/Keywords/del',array('del'=>$vo['id']))}"></a>
                            </td>
                        </tr>
                        </volist>       
                </tbody>
            </table>
                <div class="page">
                    <span>共 {$count} 条</span>
                    <div class="paging">
                        {$page}
                    </div>
                    前往<input type="text" value="{$p}" name='page' onchange="mychange()">页
                </div>    
            </div>

            <div class="modal fade bs-example-modal-lg">
            <div class="modal-dialog modal-lg">
                <div class="modal-content" style="padding: 30px 0 76px 30px">
                    <form action="{:U('Admin/Keywords/addSite')}" method="post">
                        
                    <input type="hidden" value="{$query_id}" name="query_id">
                    <div class="platform">
                        <h3>请选择需要优化的搜索平台</h3>
                        <div>
                            <p>pc端&nbsp;&nbsp;&nbsp; <input type="checkbox" name="seo[]" value="1" checked  />百度<input type="checkbox" name="seo[]" value="2" checked />360 <input type="checkbox" name="seo[]" value="3" checked />搜狗 </p>
                            <p>移动端 <input type="checkbox" name="seo[]" value="4" checked />百度<input type="checkbox" name="seo[]" value="5" checked />360 <input type="checkbox" name="seo[]" value="6" checked />搜狗 </p>
                        </div>
                    </div>
                    <div class="add-information">
                        <h3>添加你要优化的站点及FTP信息<span>(添加FTP信息将更有利于网站优化)</span></h3>
                        <div class="add-information-list">
                            <div>
                                <label>站点</label>
                                <input type="text" placeholder="www.baidu.com" name="site">
                            </div>
                            <div>
                                <label>FTP IP</label>
                                <input type="text" placeholder="请输入FTP IP" name="ftp_ip">
                            </div>
                            <div>
                                <label>FTP用户名</label>
                                <input type="text" placeholder="请输入FTP用户名" name="username">
                            </div>
                            <div>
                                <label>FTP 密码</label>
                                <input type="text" placeholder="请输入FTP密码" name="password">
                            </div>
                            <div>
                                <label>网站后台地址</label>
                                <input type="text" placeholder="请输入网站后台地址" style="width:205px;" name="adminadd">
                            </div>
                            <div>
                                <label>后台用户名</label>
                                <input type="text" placeholder="请输入网站后台用户名" style="width:205px;" name="adminusername">
                            </div>
                            <div>
                                <label>后台密码</label>
                                <input type="text" placeholder="请输入网站后台密码" style="width:205px;" name="adminpassword">
                            </div>
                            <!-- <div>
                                <label>站点2</label>
                                <input type="text" placeholder="www.baidu.com" name="site[]">
                            </div>
                            <div>
                                <label>FTP IP</label>
                                <input type="text" placeholder="请输入FTP IP" name="ftp_ip[]">
                            </div>
                            <div>
                                <label>FTP用户名</label>
                                <input type="text" placeholder="请输入FTP用户名" name="username[]">
                            </div>
                            <div>
                                <label>FTP 密码</label>
                                <input type="text" placeholder="请输入FTP密码" name="password[]">
                            </div>
                            <div>
                                    <label>网站后台地址</label>
                                    <input type="text" placeholder="请输入网站后台地址" style="width:205px;" name="adminadd[]">
                                </div>
                                <div>
                                    <label>后台用户名</label>
                                    <input type="text" placeholder="请输入网站后台用户名" style="width:205px;" name="adminusername[]">
                                </div>
                                <div>
                                    <label>后台密码</label>
                                    <input type="text" placeholder="请输入网站后台密码" style="width:205px;" name="adminpassword[]">
                                </div>
                            <div>
                                <label>站点3</label>
                                <input type="text" placeholder="www.baidu.com" name="site[]">
                            </div>
                            <div>
                                <label>FTP IP</label>
                                <input type="text" placeholder="请输入FTP IP" name="ftp_ip[]">
                            </div>
                            <div>
                                <label>FTP用户名</label>
                                <input type="text" placeholder="请输入FTP用户名" name="username[]">
                            </div>
                            <div>
                                <label>FTP 密码</label>
                                <input type="text" placeholder="请输入FTP密码" name="password[]">
                            </div>
                            <div>
                                <label>网站后台地址</label>
                                <input type="text" placeholder="请输入网站后台地址" style="width:205px;" name="adminadd[]">
                            </div>
                            <div>
                                <label>后台用户名</label>
                                <input type="text" placeholder="请输入网站后台用户名" style="width:205px;" name="adminusername[]">
                            </div>
                            <div>
                                <label>后台密码</label>
                                <input type="text" placeholder="请输入网站后台密码" style="width:205px;" name="adminpassword[]">
                            </div> -->
                        </div>
                    </div>
                    <div class="select-customers" style="margin-top:200px">
                        <h3>选择客户</h3>
                        <select name="user_id">
                            <volist name="users" id="v">
                                <option value="{$v['user_id']}">{$v['user_name']}</option>
                            </volist>
                        </select>
                    </div>
                    <div class="submit">
                        <button type="submit">提交</button>
                        <button type="reset">取消</button>
                    </div>
                   
                   </form>
                </div>
            </div>
        </div>
<script type="text/javascript">
    $("#sub").click(function(){
        var search = $('.search').val();
        window.location.href = "/Admin/Keywords/index.html?search="+search;
    });

    function mychange(){
      var page =  $('input[name="page"]').val();
      window.location.href = "/index.php/Admin/Keywords/index/p/"+page;
    }

    document.onclick = function(e) {
        var modal = 　$('.modal').css('display');
        // console.log(modal);
        if(modal == 'block'){
            $('.modal').css('display','none');
            $(".modal").removeClass("show");
            $("body").removeClass("modal-open");
            $("body").css("padding-right",'0');
            $(".modal-backdrop").remove();
        }　　　　　
    }


    $(".add").click(function(){

        // var id = $(this).attr('id');
        // $.ajax({
        //     url:'/Admin/Keywords/edit',    //请求的url地址
        //     dataType: "JSON",   //返回格式为json
        //     async: true,//请求是否异步，默认为异步，这也是ajax重要特性
        //     type: "post",   //请求方式
        //     data:{
        //         id:id,
        //     },

        //     success: function (data) {
        //         if(data.state==1){
        //             // console.log(data.data)
        //             $.each(data.data, function (i, item) {
        //                 // console.log(i);
        //                 $('input[name='+i+']').val(item);
        //             });
        //             console.log(data.value);
        //             $("select[name='admin_id']").find("option[value="+data.value+"]").attr("selected",true);

        //         }else{
        //             console.log(data.data)
        //             return false;
        //         }
        //     }
        // })

        $("body").addClass("modal-open");
        $(".modal").addClass("show");
        $('.modal').css('display','block');
        $('input[name="act"]').val('edit');
        $("body").append("<div class='modal-backdrop fade show'></div>");

    });
    
    $(".modal-content").click(function(event){
        event.stopPropagation();
    });

    $(".add").click(function(event){
        event.stopPropagation();
    });
</script>